import request from "@/axios/request";
import url from "@/axios/url";
const { mesUrl, adminUrl, wmsUrl } = url();
// 导出url
export const exportUrl = `${mesUrl}mesProdOrder/export`;

// 获取详情
export function getInfo(id = "") {
  return request({
    url: `${mesUrl}mesProdOrder/info/${id}`,
    method: "get",
  });
}
//分页查询
export function getList(params = {}) {
  return request({
    url: `${mesUrl}mesProdOrder/selectList`,
    method: "get",
    params,
  });
}
export function getListNew(params = {}) {
  return request({
    url: `${mesUrl}mesProdOrder/selectListNew`,
    method: "get",
    params,
  });
}
// 查询线体编码列表
export function getLineCodeList(params) {
  return request({
    url: `${adminUrl}baseFactoryModeling/children`,
    method: "get",
    params,
  });
}

// 是否正在执行接口(0:否,1:是)
export function getIsRunningList() {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: "get",
  });
}
// 查询订单状态（未开始，进行中，已完成，待下发，已下发）列表
export function getProdOrderStatusList() {
  return request({
    url: `${adminUrl}dict/type/prod_order_status`,
    method: "get",
  });
}
// 查询前置工单类型列表
export function getPrepositionTypeList() {
  return request({
    url: `${adminUrl}dict/type/order_preposition_type`,
    method: "get",
  });
}
// 查询生产订单类型：内销，外销，样机列表
export function getProdOrderTypeList() {
  return request({
    url: `${adminUrl}dict/type/prod_order_type`,
    method: "get",
  });
}
// 查询  0：自动倒冲，1：手动倒冲列表
export function getBackflushTypeList() {
  return request({
    url: `${adminUrl}dict/type/backflush_type`,
    method: "get",
  });
}
// 查询虚实订单类型（无bom虚单，实单，bom需单）列表
export function getSimulatedTypeList() {
  return request({
    url: `${adminUrl}dict/type/simulated_type`,
    method: "get",
  });
}
//------------------------------------------------
/* 条码打印模板下拉列表 */
export function barcodePrintingList2(data = "") {
  return request({
    url: `${adminUrl}printTemplate/list`,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    method: "post",
    data: data,
  });
}
/* 打印模板详情 */
export function printTemplateInfo(id = "") {
  return request({
    url: `${adminUrl}printTemplate/info/${id}`,
    method: "get",
  });
}

/* 条码打印详情 */
export function barcodePrintingDetail(params) {
  return request({
    url: `${wmsUrl}wmsInventorySn/info`,
    method: "get",
    params,
  });
}
/* 条码打印新增 */
export function barcodePrintingAdd(data = "") {
  return request({
    url: `${wmsUrl}wmsReprintCode/addReprintCode`,
    method: "post",
    params: data,
  });
}
/* 条码打印新增 */
export function barcodePrintingAdd2(data = "") {
  return request({
    url: `${wmsUrl}wmsReprintCode/addSplitCode`,
    method: "post",
    params: data,
  });
}

/* 生码 */
export function creatBoxCode(data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode`,
    method: "post",
    data,
  });
}
/* 箱码列表 */
export function mesProdBoxcode(data = {}) {
  return request({
    url: `${mesUrl}mesProdBoxcode/list`,
    // url: `${messerviceUrl}mesProdBoxcode/getPrintList`,
    method: "get",
    params: data,
  });
}
/* 箱码列表 */
export function baseCodeStrategy(data = {}) {
  return request({
    url: `${adminUrl}baseCodeStrategy/list`,
    method: "get",
    params: data,
  });
}

/* 打印箱码 */
export function printBoxcode(data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/printBoxcode`,
    method: "post",
    data,
  });
}
/* 清除箱码 */
export function clearBoxcode(data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/clearBoxcode`,
    method: "post",
    data,
  });
}
/* 补打查询-（箱码数量、起止条码 */
export function reprintSel(data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/reprintSel`,
    method: "post",
    data,
  });
}
/* 补打查询--箱码列表 */
export function reprintSelList(data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/reprintSelList`,
    method: "post",
    data,
  });
}
/* 箱码打印-获取条码数量，已打印、未打印数量 */
export function getBoxCount(data = "") {
  return request({
    url: `${mesUrl}mesProdBoxcode/getBoxCount`,
    method: "post",
    data,
  });
}

/* 箱码打印记录补打 */
export function reprintBoxcode(ids = "") {
  return request({
    url: `${mesUrl}mesBoxcodeprintHistory/reprintBoxcode/${ids}`,
    method: "get",
  });
}
/* 跟踪卡打印记录-补打 */
export function rePrintBarcode(ids = "") {
  return request({
    url: `${mesUrl}mesBarCodePrintHistory/rePrintBarcode/${ids}`,
    method: "get",
  });
}
export function rePrintBarcodeNew(data = {}) {
  return request({
    url: `${mesUrl}mesTrackingCardPrintingHistory/rePrintBarcode`,
    method: "post",
    data,
  });
}
/*
补打物料流转卡-补打 */
export function reprintMaterial(ids = "") {
  return request({
    url: `${mesUrl}mesMaterialPrintHistory/reprintMaterial/${ids}`,
    method: "get",
  });
}

//容量码 根据订单获取型号
export function getProdByOrder(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/getProdByOrder`,
    method: "get",
    params: data,
  });
}

//根据物料查询标签模板/编码规则
export function selectCommonProduceTemplateRelByProduce(data = {}) {
  return request({
    url: `${adminUrl}commonProduceTemplateRel/selectCommonProduceRelByProduce`,
    method: "get",
    params: data,
  });
}

//根据物料查询编码规则
export function selectCommonProduceRelByProduce(data = {}) {
  return request({
    url: `${adminUrl}commonProduceTemplateRel/selectCommonProduceRelByProduce`,
    method: "get",
    params: data,
  });
}

//容量码 根据订单获取型号
export function templateType(data = {}) {
  return request({
    url: `${adminUrl}dict/type/template_type_capacitycode`,
    method: "get",
    params: data,
  });
}

// 校验是否已经生成对应类型容量码
export function checkCapacityCode(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/checkCapacityCode`,
    method: "post",
    data,
  });
}

// 校验是否已经生成对应类型容量码
export function genCodeBatch(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/genCodeBatch`,
    method: "post",
    data,
  });
}

// 校验是否已经生成对应类型容量码
export function getCodeList(data = {}) {
  return request({
    url: `${mesUrl}/mesProdCapacityCode`,
    method: "get",
    data,
  });
}

// 获取是否
export function getYesOrNot() {
  return request({
    url: `${adminUrl}dict/type/yes_or_not`,
    method: "get",
  });
}

// 获取主表详情
export function getMasterInfo(id = "") {
  return request({
    url: `${mesUrl}mesProdBarcode/info/${id}`,
    method: "get",
  });
}
//5-10

// 查询打印条码模板名称列表
export function getBarcodePrintTempList(data = {}) {
  return request({
    url: `${adminUrl}printTemplate/getTempList`,
    method: "post",
    data,
  });
}

// 获取容量/数量列表接口
export function getCapacityCodeList(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/getCapacityCodeTempAndCodeList`,
    method: "post",
    data,
  });
}

//根据打印模板名称获取详情
export function detailbyName(data = {}) {
  return request({
    url: `${adminUrl}printTemplate/detailbyName`,
    method: "post",
    data,
  });
}

// 获取本次要打印的条码信息
export function splitPrintList(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/splitPrintList`,
    method: "post",
    data,
  });
}

//容量码清除
export function clearCapacityCode(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/clearCapacityCode`,
    method: "post",
    data,
  });
}

//补打审核列表查询
export function mesProdCapacitycodeReprint(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCodeReprint`,
    method: "get",
    params: data,
  });
}

//补打审核列表查询
export function reprintCapacitySel(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/reprintCapacitySel`,
    method: "post",
    data,
  });
}
//补打审核新增
export function insert(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCodeReprint/insert`,
    method: "post",
    data,
  });
}

//补打审核删除
export function reprintCapacityDel(id = "") {
  return request({
    url: `${mesUrl}mesProdCapacityCodeReprint/${id}`,
    method: "PUT",
  });
}

//补打查询获取需补打的条码信息
export function reprintCapacitySelList(data = {}) {
  return request({
    url: `${mesUrl}mesProdCapacityCode/reprintCapacitySelList`,
    method: "post",
    data,
  });
}

//校验容量码补打是否需要审核
export function selectListByConfigurationCode(data = {}) {
  return request({
    url: `${adminUrl}commonConfigurationItem/selectListByConfigurationCode`,
    method: "get",
    params: data,
  });
}
